home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / human interface toolbox / splasher / template.c < prev   
Encoding:
C/C++ Source or Header  |  2000-06-23  |  1.8 KB  |  70 lines

  1. /*
  2.     File:        Template.c
  3.  
  4.     Contains:    splasher:  A very simple application that displays a "modal" window that goes
  5.                 away as soon as you click the mouse or press a key.  This is how many splash
  6.                 screens behave -- but as long as the window is displayed, the Process Manager
  7.                 won't switch your application from being frontmost.
  8.  
  9.     Written by:     
  10.  
  11.     Copyright:    Copyright © 1984-1999 by Apple Computer, Inc., All Rights Reserved.
  12.  
  13.                 You may incorporate this Apple sample source code into your program(s) without
  14.                 restriction. This Apple sample source code has been provided "AS IS" and the
  15.                 responsibility for its operation is yours. You are not permitted to redistribute
  16.                 this Apple sample source code as "Apple sample source code" after having made
  17.                 changes. If you're going to re-distribute the source, we require that you make
  18.                 it clear in the source that the code was descended from Apple sample source
  19.                 code, but that you've made changes.
  20.  
  21.     Change History (most recent first):
  22.                 8/9/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  23.                 
  24.  
  25. */
  26. #include <Quickdraw.h>
  27. #include <Fonts.h>
  28. #include <Windows.h>
  29. #include <Dialogs.h>
  30. #include <TextEdit.h>
  31. void main()
  32.  
  33. {
  34.  
  35. GrafPort myPort;
  36. WindowPtr myWindow;
  37. EventRecord myEvent;
  38. Boolean doQuit;
  39.  
  40.  
  41.     InitGraf((Ptr) &qd.thePort);
  42.     OpenPort(&myPort);
  43.     InitFonts();
  44.     InitWindows();
  45.     InitMenus();
  46.     TEInit();
  47.     InitDialogs(nil);
  48.     InitCursor();
  49.     
  50.     doQuit = false;
  51.     myWindow = GetNewWindow(128, NULL, (WindowPtr)-1L);
  52.     SetPort(myWindow);
  53.     MoveTo(15,15);
  54.     DrawString("\pThis is our splash screen test of the mouse...");
  55.     while (doQuit == false) {
  56.         if(WaitNextEvent(everyEvent, &myEvent, 10L, NULL)) {
  57.             switch (myEvent.what) {
  58.             case mouseDown:
  59.             case autoKey:
  60.             case keyDown: {
  61.                 DisposeWindow(myWindow);
  62.                 doQuit = true;
  63.                 break;
  64.                 }
  65.             };
  66.         }
  67.     }
  68.     ExitToShell();
  69. }
  70.